﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using GPI.Server;
using VTemplate.Engine;
using System.Text;
using Moon.Common.WebInfo;
using Model;

public partial class ShowPage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string id = Request.QueryString["id"] != null ? Request.QueryString["id"].ToString() : "";
            if (!id.IsNullOrEmpty())
            {
                try
                {
                    NodeService server = new NodeService();
                    NodeInfo model = server.GetModel(id.ToInt(0));
                    TemplateService template = new TemplateService();
                    TemplateDocument document = new TemplateDocument(Server.MapPath("~/") + template.GetModel(model.Template.Value).FilePath, Encoding.UTF8);
                    document.Render(Response.Output);
                }
                catch (Exception ex)
                {
                    Response.Output.Write("Not Found 404!" + ex.Message);
                }
        
            }
        }
        
    }
}
